package com.cqemme.comm.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author tommy
 */
public enum AlarmType {
    SOS_ALARM(8,"校徽SOS报警","sos_alarm"),
    FIRE(6,"火灾报警","fire"),
    ELECTRONIC_FENCE(12,"电子围栏报警","electronic_fence"),
    ALARM_PILLAR(14,"报警住报警","alarm_pillar"),
    PRECAUTIONARY_AREA(16,"防区报警","precautionary_area"),
    BLACKLIST(17,"系统识别黑名报警","blacklist_alarm"),
    IRRELEVANT_PERSONNEL_WANDERING(18,"非校内人员徘徊","irrelevant_personnel_wandering"),
    MJ_ILLEGAL_ACCESS(19,"门禁非法出入","illegal_access"),
    DZWL_ILLEGAL_INTRUSION(7,"电子围栏非法入侵","electronic_fence_Illegal_intrusion");

    private int key;
    private String cName;
    private String eName;

    public static String getcName(int key) {
        AlarmType[] p = values();
        for (int i = 0; i < p.length; ++i) {
            AlarmType type = p[i];
            if (type.getKey()==key) {
                return type.getcName();
            }
        }
        return null;
    }
    public static String geteName(int key) {
        AlarmType[] p = values();
        for (int i = 0; i < p.length; ++i) {
            AlarmType type = p[i];
            if (type.getKey()==key) {
                return type.geteName();
            }
        }
        return null;
    }

    public static Map<Integer,String> getCnameMap() {
        Map<Integer,String> map=new HashMap<Integer,String>();
        AlarmType[] p = values();
        for (AlarmType type : p) {
            map.put(type.getKey(), type.getcName());
        }
        return map;
    }

    public static Map<Integer,String> getEnameMap() {
        Map<Integer,String> map=new HashMap<Integer,String>();
        AlarmType[] p = values();
        for (AlarmType type : p) {
            map.put(type.getKey(), type.geteName());
        }
        return map;
    }

    public int getKey() {
        return key;
    }
    public String getcName() {
        return cName;
    }
    public String geteName() {
        return eName;
    }
    AlarmType(int key, String cName ,String eName){
        this.key = key;
        this.cName = cName;
        this.eName = eName;
    }
}
